<template>
    <el-container>
        <el-header>
            <el-container>
                <PrimaryButton text="增加" :click="showAdd" />
                <SearchInput placeholder="请输入医生姓名" :change="(value)=>handleChange(value,'ysName')" />
                <SearchButton :click="search" />
            </el-container>
        </el-header>
        <el-main>
            <el-table stripe :data="tableData" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" v-loading.fullscreen.lock="loading">
                <el-table-column prop="id" label="医生编号" width="80" />
                <el-table-column prop="mu" label="医生MU" width="80" />
                <el-table-column prop="ysName" label="医生名称" width="80" />
                <el-table-column prop="fwxm" label="服务项目" width="100" />
                <el-table-column prop="fwjg" label="服务价格" width="100" />
                <el-table-column prop="ysrc" label="医生标签" width="120">
                    <template #={ysrc,ysjb,ysjy}>
                        <div>{{ysrc}}</div>
                        <div>{{ysjb}}</div>
                        <div>{{ysjy}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="zsList" label="诊所 | 地址 | 预约状态" min-width="120">
                    <template #={zsList}>
                        <div v-for="({zsName,city,dist,street,addr,status}, index) in zsList" :key="index">
                            {{zsName}}
                            <el-divider direction="vertical" />
                            {{city}}{{dist}}{{street}}{{addr}}
                            <el-divider direction="vertical" />
                            <span style="color: #67c23a" v-if="status=='1'">正常营业</span>
                            <span style="color: #f56c6c" v-if="status=='0'">已休息 </span>
                            <el-divider v-if="zsList.length>index+1" />
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="readNum" label="访问量" width="80">
                    <template #={readNum}>
                        <el-tag>{{readNum}}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="createTime" label="创建时间" width="100" />
                <el-table-column prop="adminName" label="添加人员" width="90" />
                <el-table-column label="操作" width="120">
                    <template #={mu}>
                        <PlainButton text="编辑医生" :click="()=>showUpdate(mu)" />
                        <PlainButton text="添加案量" :click="()=>showAddAl(mu)" />
                        <PlainButton text="删除" :click="()=>doDelete(mu)" />
                    </template>
                </el-table-column>
            </el-table>
            <SearchPagination :currentPage="currentPage" :total="total" :limit="limit" @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange" />
        </el-main>
    </el-container>
</template>
<script>
import { page, remove } from '@/chaos/functions/mixin/crud';
import { pushcreate, pushupdate } from '@/chaos/functions/mixin/pushcrud';

export default {
    name: 'doctors',
    mixins: [page, remove, pushcreate, pushupdate],
    data() {
        return {
            domain: 'iya_doctor',
            addPath: 'addDocter',
            updatePath: 'updateDocter'
        };
    },
    created() {
        this.search();
    },
    methods: {
        showAddAl(doctorMu) {
            this.$router.push({
                name: 'doctoral',
                params: { doctorMu }
            });
        }
    }
};
</script>

<style lang="less" scoped>
.el-form {
    width: 500px;
}
</style>
